package com.qxgltj.qxgl.model;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import lombok.Data;
@Table
@Data
@Entity
@GenericGenerator(name = "jpa-uuid",strategy = "uuid")
public class Roles {
    @Id
    @GeneratedValue(generator = "jpa-uuid")
    @Column(length = 32)
 private String id;//用户组编号
 @NotBlank
 @Column(unique = true,nullable = false)
 private String name;//角色名称
 //角色权限
 //@JsonIgnore
 @ManyToMany(cascade = CascadeType.REFRESH)
 @JoinTable(
     name = "role_modules",
     inverseJoinColumns = {@JoinColumn(name="module_id")},
     joinColumns = {@JoinColumn(name="role_id")}
 )
 @NotFound(action = NotFoundAction.IGNORE)//如果找不到就跳
 private List<Modules> moduleslist;//模块表
}